package com.king.juc.atomicdemo.account;

/**
 * 保护共享资源: 不安全案例
 * @author king
 * @date 2020/11/29 16:53
 */
public class AccountUnsafe implements Account {

    private Integer balance;

    public AccountUnsafe(Integer balance) {
        this.balance = balance;
    }

    @Override
    public Integer getBalance() {
        return balance;
    }

    @Override
    public void withdraw(Integer amount) {
        this.balance -= amount;
    }
}
